#ifndef __MISC_HTTP_H__
#define __MISC_HTTP_H__

enum {
	HTTP_MISC_HEADER = 0,
	HTTP_MISC_BODY,
	HTTP_MISC_END,
	HTTP_MISC_ERROR,
};

typedef struct StNameValue {
    char *name;
    char *value;
}StNameValue;


extern struct StMiscHttpObj;
typedef int(*FUN_PARSER)(struct StMiscHttpObj *pHttpObj, char *data, int len);
typedef struct StMiscHttpObj {
	char *url;
	int is_break;
	int status;
	FUN_PARSER parser;
	void *user;
}StMiscHttpObj;
int misc_http_post_content(StMiscHttpObj *http_obj, char *url, char *add_header, char *content, int timeout_ms);
int misc_http_post_form(StMiscHttpObj *http_obj, char *url, char *boundary, struct StNameValue *arr_content, int arr_cnts, int timeout_ms);
int misc_http_get(StMiscHttpObj *http_obj, char *url, int timeout_ms);
int misc_http_init(struct StMiscHttpObj *http_obj, FUN_PARSER my_parser, void *user);
int misc_http_deinit(struct StMiscHttpObj *http_obj);

#endif
